# Adding application
Eye.application '<%= fetch(:application)%>' do
  notify :<%= fetch(:eye_notification_contact) %>, :<%= fetch(:eye_notification_level) %>
  notify :chat_room, :<%= fetch(:eye_notification_level) %>

  load_env '<%= shared_path %>/.rbenv-vars'

  env RBENV_ROOT: "<%= fetch(:rbenv_path) %>"
  env RBENV_VERSION: "<%=fetch(:rbenv_ruby) %>"
  env RAILS_ENV: "<%= fetch(:rails_env) %>"

  # All options inherits down to the config leafs.
  # except `env`, which merging down
  working_dir '<%= current_path %>'
  stdall '<%= shared_path %>/log/eye.log'

  chain grace: <%= fetch(:eye_chaing_grace, 20) %>.seconds

  trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes

  check :cpu, every: 10.seconds, below: 100, times: 3 # global check for all processes

<% processes.each do |process_name, options| -%>
<%= partial options[:template], binding %>
<% end -%>

end
